﻿#pragma once

#include <QWidget>
#include "json_data.h"


QT_BEGIN_NAMESPACE
namespace Ui { class PipelineSettingWid; };
QT_END_NAMESPACE

class PathSettingWid;
class PipelineSettingWid : public QWidget
{
	Q_OBJECT

public:
	PipelineSettingWid(QWidget* parent = nullptr);
	~PipelineSettingWid();
	void Init(const PipelineCfg& cfg);
	PipelineCfg GetCfg();


private slots:
	//void on_pushButton_add_clicked();
	//void on_tabWidget_tabCloseRequested(int index);
	void on_pushButton_clicked();
	void on_pushButton_2_clicked();

	// 添加路径
	void on_pushButton_3_clicked();
	// 删除路径
	void on_pushButton_4_clicked();

	void on_tableWidget_cellPressed(int row, int colum);
	void on_save_path();

	void on_comboBox_currentIndexChanged(int index);
private:
	void AddPathToTabWidget(PathCfg& info);
	PathCfg SavePathFromTabWidget(int row);

	void RefreshPoint(int type);

private:
	Ui::PipelineSettingWid* ui;
	int m_pathNum = 3;
	PathSettingWid* m_path = nullptr;

	QMap<QString, PathCfg> m_paths;
};
